<?php

namespace App\Http\Requests;

use App\Models\CoinsConfig;
use Illuminate\Foundation\Http\FormRequest;

class CoinsConfigRequest extends FormRequest
{
    use CommonRequest;

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'param_name' => [
                'required',
                'exists:life_coins_config,param_name',
                ],
            'param_value' => 'required|integer',
        ];
    }

    public function messages()
    {
        return [
            'param_name.required' => '选择的设置项不存在',
            'param_name.exists' => '选择的设置项不存在',
            'param_value.required' => '值不能为空',
            'param_value.numeric' => '值需要为整数',
        ];
    }
}
